package com.shujujiegou.无权无向图.搜索.实现广度优先搜索的队列;

public class StackX {
    private final int SIZE = 20;
    private int[] st;
    private int top;
    private int size;

    public StackX() {
        st = new int[SIZE];
        top = -1; // -1表示无数据
    }

    public void push(int data) {
        if(isFull()) {
            return;
        }

        st[++top] = data;
        this.size++;
    }

    public int pop() {
        this.size--;
        return st[top--];
    }

    public int peek(){
        return st[top];
    }

    public boolean isEmpty() {
        return this.size <= 0 ? true : false;
    }

    public boolean isFull() {
        return this.size == SIZE ? true : false;
    }

}
